package cn.zn.controller.system;

import cn.zn.base.bean.dto.ResultData;
import cn.zn.base.common.utils.ResultUtil;
import cn.zn.dept.entity.SysCorp;
import cn.zn.dept.service.SysCorpService;
import cn.zn.menu.dto.TreeSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zn-admin
 * @since 2021-03-04
 */
@RestController
@RequestMapping("/system/corp")
public class SysCorpController {

    @Autowired
    private SysCorpService corpService;

    /**
     * 获取产业树
     *
     * @return 结果
     */
    @GetMapping("/tree")
    public ResultData corpTree() {
        List<TreeSelectDto> corps = corpService.selectCorpTree();
        return ResultUtil.success(corps);
    }

    @GetMapping("/list")
    public ResultData corpList() {
        List<SysCorp> corps = corpService.selectCorpList();
        return ResultUtil.success(corps);
    }

}
